package com.yylending.las.main;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.text.TextUtils;
import android.util.SparseIntArray;
import cn.jpush.android.api.JPushInterface;
import com.yyfax.common.CLog;
import com.yyfax.common.tabbar.TabBar;
import com.yyfax.infrastructure.eventbus.EventAgent;
import com.yyfax.infrastructure.mvp.IEvent;
import com.yyfax.infrastructure.mvp.Presenter;
import com.yyfax.infrastructure.mvp.PresenterLoader;
import com.yyfax.infrastructure.statistics.StatService;
import com.yylending.las.*;
import com.yylending.las.authority.login.LoginActivity;
import com.yylending.las.common.utils.EmulatorChecker;
import com.yylending.las.common.widgets.CommonDialog;
import com.yylending.las.common.widgets.InviteCodeVerifyDialog;
import com.yylending.las.lending.QuotaEvent;
import com.yylending.las.lending.increase.CheckPromoteStatusActivity;
import com.yylending.las.lending.quota.myquota.MyQuotaModel;
import com.yylending.las.lending.quota.myquota.MyQuotaPresenter;
import com.yylending.las.main.message.MessageActivity;
import com.yylending.las.main.message.MsgStatusPresenter;
import com.yylending.las.webview.WebViewActivity;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.HashMap;

/**
 * Created by HenryZhang on 2016/10/25.
 * Copyright © 2016 www.yyfax.com. All Rights Reserved.
 */
public class MainActivity extends MainInnerActivity implements MyQuotaPresenter.View, MsgStatusPresenter.View,
		CommonDialog.ButtonClickListener {

	private final static String TAG = "MainActivity";

	public final static int TAB_INDEX_LENDING = 0;
	private final static int TAB_INDEX_REPAYMENT = TAB_INDEX_LENDING + 1;
	private final static int TAB_INDEX_PERSONAL_CENTER = TAB_INDEX_LENDING + 2;

	private final static String EXTRA_KEY_LOGIN_ATY = "login_activity";
	private final static String EXTRA_KEY_VIEW_MESSAGE = "go_message_activity";
	private final static String KEY_CURRENT_PAGE = "current_page";
	private final static String KEY_PREVIOUS_PAGE = "previous_page";

	private static final int LOADER_ID_QUOTA = 6;
	public static final int LOADER_ID_BANK_CARD = 7;
	public static final int LOADER_ID_MY_LENDING = 8;
	public static final int LOADER_ID_GET_REAL_NAME = 9;
	public static final int LOADER_ID_GET_MSG_STATUS = 10;


	private MyQuotaPresenter mMyQuotaPresenter;
	private MsgStatusPresenter mMsgStatusPresenter;


	private TabBar mTabBottom;

	private int mCurrentPage = Constants.PAGE_LOADING;
	/**上一次显示的借钱界面*/
	private int mPreviousLendingPage = Constants.PAGE_LOADING;
	/**
	 * 当前Tab
	 */
	private int mCurrentTab = TAB_INDEX_LENDING;

	protected MyQuotaModel.ApplyStatus mApplyStatus, mOriginalApplyStatus;
	/**
	 * 保存的借钱首页之前显示的tab(手机借钱或门店借钱)
	 */
	protected int mSavedTab;
	/**
	 * 获取额度操作失败
	 */
	protected boolean mGetQuotaFail = false;
	/**
	 * 借款须知Dialog
	 */
	private CommonDialog mLoanNoticeDialog;
	/**
	 * 拨打客服电话Dialog
	 */
	private CommonDialog mCallDialog;
	/**
	 * 客服电话
	 */
	private String mPhoneNumber;
	public String mRepayStatus;

	private InviteCodeVerifyDialog mCodeVerifyDialog;
	/**
	 * 是否第一次进入主页
	 */
	private boolean mIsFirst;
	/**
	 * 是否需要自动弹出视频认证需要准备身份证的提示框
	 */
	protected boolean mVideoVerifyHintAuto = false;
	boolean mBackGround = false;
	boolean mHasNewPush = false;

	public static void start(Activity context) {
		Intent intent = new Intent(context, MainActivity.class);
		context.startActivity(intent);
	}

	public static void start(Activity aty, boolean goLoginPage) {
		Intent intent = new Intent(aty, MainActivity.class);
		intent.putExtra(EXTRA_KEY_LOGIN_ATY, goLoginPage);
		aty.startActivity(intent);
	}

	public static void start(Context aty, boolean goLoginPage, boolean viewMessage) {
		Intent intent = new Intent(aty, MainActivity.class);
		intent.putExtra(EXTRA_KEY_LOGIN_ATY, goLoginPage);
		intent.putExtra(EXTRA_KEY_VIEW_MESSAGE, viewMessage);
		if(Build.VERSION.SDK_INT < Build.VERSION_CODES.N){
			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		}
		aty.startActivity(intent);
	}

	@Override
	public Loader<Presenter> onCreateLoader(int id, Bundle args) {
		switch (id) {
			case LOADER_ID_QUOTA:
				return new PresenterLoader<>(this, new MyQuotaPresenter.Generator());
			case LOADER_ID_GET_MSG_STATUS:
				return new PresenterLoader<>(this, new MsgStatusPresenter.Generator());
			default:
				return super.onCreateLoader(id, args);
		}
	}

	@Override
	public void onLoadFinished(Loader<Presenter> loader, Presenter data, int placeholder) {
		switch (loader.getId()) {
			case LOADER_ID_QUOTA:
				mMyQuotaPresenter = (MyQuotaPresenter) data;
				mMyQuotaPresenter.attach(this);
				break;
			case LOADER_ID_GET_MSG_STATUS:
				mMsgStatusPresenter = (MsgStatusPresenter) data;
				mMsgStatusPresenter.attach(this);
				break;
			default:
				super.onLoadFinished(loader, data, placeholder);
				break;
		}
	}

	@Override
	protected void onDestroy() {
		dismissLoanNoticeDialog();
		dismissCallDialog();
		mCallDialog = null;
		super.onDestroy();
		getSupportLoaderManager().destroyLoader(LOADER_ID_QUOTA);
		getSupportLoaderManager().destroyLoader(LOADER_ID_GET_MSG_STATUS);
		dismissCodeVerifyDialog();
	}

	private void dismissCodeVerifyDialog() {
		if (mCodeVerifyDialog != null && mCodeVerifyDialog.isShowing()) {
			mCodeVerifyDialog.dismiss();
			mCodeVerifyDialog = null;
		}
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		setTopBarVisible(false);
		EventAgent.register(this);
		mIsFirst = true;

		mTabBottom = (TabBar) findViewById(R.id.main_tabs_bottom);
		mTabBottom.setOnTabChangedListener(mTabChangedListener);
		//tab.setBadgeCount(88);

		if (null != savedInstanceState && YJKD.login()) {
			restoreData(savedInstanceState);
		}
		Intent i = getIntent();
		if (null != i && i.getBooleanExtra(EXTRA_KEY_LOGIN_ATY, false)) {//自动跳到登录页面
			LoginActivity.start(this);
		}
		if (null != i) {
			mHasNewPush = i.getBooleanExtra(EXTRA_KEY_VIEW_MESSAGE, false);
		}
		//有新push且已解锁，自动跳到消息页面
		if (mHasNewPush && Global.NEW_PUSH && !Global.LOCKED) {
			MessageActivity.start(this);
		}
		Global.NEW_PUSH = false;
		mHasNewPush = false;

		getSupportLoaderManager().initLoader(LOADER_ID_QUOTA, null, this);
		getSupportLoaderManager().initLoader(LOADER_ID_GET_MSG_STATUS, null, this);
	}

	@Override
	protected void onStart() {
		super.onStart();
		Global.setThirdPartyPageOpenedFlag(false);

		initPage();

		checkEmulator();

		if (JPushInterface.isPushStopped(getApplicationContext())) {
			JPushInterface.resumePush(getApplicationContext());
		}
	}

	private void initPage(){
		if(Global.NEED_REFRESH){
			int currentPage = Constants.PAGE_LOADING;
			if (!YJKD.login()) {
				mCurrentTab = TAB_INDEX_LENDING;
				mTabBottom.changeTab(TAB_INDEX_LENDING);
				currentPage = mPreviousLendingPage = Constants.PAGE_NOT_APPLY;
				dismissCodeVerifyDialog();
			}
			switch (mCurrentTab) {
				case TAB_INDEX_LENDING:
					if (YJKD.login()) {
						mPreviousLendingPage = Constants.PAGE_LOADING;
						mGetQuotaFail = false;
						mMyQuotaPresenter.myQuota();
						mMsgStatusPresenter.getMsgStatus();
					}
					currentPage = mPreviousLendingPage;
					break;
				case TAB_INDEX_REPAYMENT:
				case TAB_INDEX_PERSONAL_CENTER:
					currentPage = mTabToPageCodeArray.get(mCurrentTab, Constants.PAGE_NOT_APPLY);
					break;
				default:
					break;
			}
			showFragment(mCurrentTab, currentPage);
		}
		Global.NEED_REFRESH = true;
	}

	@Override
	protected void onPause() {
		super.onPause();
		mBackGround = true;
	}

	private void checkEmulator() {
		try {
			com.yyfax.infrastructure.Constants.sIsEmulator = EmulatorChecker.checkEmulatorBuild(this)
					|| EmulatorChecker.checkDeviceIDS(this)
					|| EmulatorChecker.checkQEmuDriverFile()
					|| EmulatorChecker.checkOperatorNameAndroid(this)
					|| EmulatorChecker.checkImsiIDS(this);
		} catch (Exception e) {
			com.yyfax.infrastructure.Constants.sIsEmulator = false;
		}
	}

	private SparseIntArray mTabToPageCodeArray = new SparseIntArray() {{
		append(TAB_INDEX_LENDING, Constants.PAGE_NOT_APPLY);
		append(TAB_INDEX_REPAYMENT, Constants.PAGE_REPAYMENT);
		append(TAB_INDEX_PERSONAL_CENTER, Constants.PAGE_PERSONAL_CENTER);
	}};

	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		if (null != intent && intent.getBooleanExtra(EXTRA_KEY_LOGIN_ATY, false)) {//自动跳到登录页面
			int currentPage = mTabToPageCodeArray.get(mCurrentTab, Constants.PAGE_NOT_APPLY);
			showFragment(mCurrentTab, currentPage);
			LoginActivity.start(this);
		}
		if (null != intent) {
			mHasNewPush = intent.getBooleanExtra(EXTRA_KEY_VIEW_MESSAGE, false);
		}
		//有新push且已解锁，自动跳到消息页面
		if (mHasNewPush && Global.NEW_PUSH && !Global.LOCKED) {
			MessageActivity.start(this);
			Global.NEW_PUSH = false;
			mHasNewPush = false;
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		//有新push且已解锁，自动跳到消息页面
		if (mBackGround && Global.NEW_PUSH && !Global.LOCKED) {
			Global.NEW_PUSH = false;
			mHasNewPush = false;
			MessageActivity.start(this);
		}
		mBackGround = false;
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		CLog.i(TAG, "MainActivity onSaveInstanceState");
//		outState.putInt(KEY_CURRENT_PAGE, mCurrentPage);
//		outState.putInt(KEY_PREVIOUS_PAGE, mPreviousPage);
	}

	@Override
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		super.onRestoreInstanceState(savedInstanceState);
		//CLog.i(TAG, "MainActivity onRestoreInstanceState");
		//restoreData(savedInstanceState);
	}

	private void restoreData(Bundle savedInstanceState) {
		if (null != savedInstanceState) {
//			mCurrentPage = savedInstanceState.getInt(KEY_CURRENT_PAGE);
//			mPreviousPage = savedInstanceState.getInt(KEY_PREVIOUS_PAGE);
		}
	}

	private TabBar.OnTabChangedListener mTabChangedListener = new TabBar.OnTabChangedListener() {
		@Override
		public void onTabChanged(int index) {
			if (TAB_INDEX_LENDING != index && !YJKD.login()) {
				showFragment(TAB_INDEX_LENDING, Constants.PAGE_NOT_APPLY);
				mCurrentTab = TAB_INDEX_LENDING;
				//mTabBottom.changeTab(PAGE_NEED_APPLY);
				LoginActivity.start(MainActivity.this);
			} else {
				if (mCurrentTab == index)
					return;
				mCurrentTab = index;

				int currentPage = Constants.PAGE_LOADING;
				switch (index) {
					case TAB_INDEX_LENDING:
						if (YJKD.login()) {
							mPreviousLendingPage = currentPage;
							//currentPage = mPreviousLendingPage;
							mGetQuotaFail = false;
							mMyQuotaPresenter.myQuota();
							mMsgStatusPresenter.getMsgStatus();
						} else {
							currentPage = Constants.PAGE_NOT_APPLY;
							mPreviousLendingPage = currentPage;
						}
						break;
					case TAB_INDEX_REPAYMENT:
					case TAB_INDEX_PERSONAL_CENTER:
						currentPage = mTabToPageCodeArray.get(index, Constants.PAGE_NOT_APPLY);
						break;
					default:
						break;
				}
				showFragment(index, currentPage);
			}
		}
	};

	public void showFragment(int tabIndex, int page) {
		// 如果是未获取额度的状态则不刷新界面
		if(Constants.PAGE_NOT_APPLY == mCurrentPage && page == Constants.PAGE_NOT_APPLY){
			EventAgent.post(new QuotaEvent.RefreshStatusEvent(QuotaEvent.Event.QUOTA_REFRESH_NOT_APPLY, mApplyStatus));
			return;
		}
		// 如果是当前已展示额度计算中界面,则不再刷新,防止冲刷掉额度计算中界面的dialog.
		if(Constants.PAGE_CALCULATING == mCurrentPage && page == Constants.PAGE_CALCULATING){
			return;
		}
		// 如果当前展示的就是提额的Fragment,则如果此时刷新回来的状态又是提额的状态, 则不刷新界面,防止用户在填写保单过程中,已填写内容被冲刷掉
		if(Constants.PAGE_INCREASE == mCurrentPage && page == Constants.PAGE_INCREASE){
			return;
		}
		boolean sameStatus = Constants.PAGE_LOADING != page && mCurrentTab == TAB_INDEX_LENDING
				&& Constants.PAGE_COMPLEX_STATUS == mCurrentPage && null != mOriginalApplyStatus && mOriginalApplyStatus.equals(mApplyStatus);
		if(sameStatus){
			CLog.i(TAG, "状态未发生变化，界面不刷新");
			return;
		}

		mCurrentPage = page;
		mTabBottom.changeTab(tabIndex);
		if (tabIndex == TAB_INDEX_LENDING) {
			mPreviousLendingPage = page;
		}
		MainController.switchState(this, page);
	}

	/**
	 * 会话超时处理
	 *
	 * @param event 会话超时event
	 */
	@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
	public void handleSessionTimeout(IEvent.UnLoginEvent event) {
		EventAgent.removeStickyEvent(event);
		// 这里再判断一下，如果当前标记是登录状态才往下传，否则说明已经是未登录状态了，不需要再跳转，防止多次跳转。
		if (YJKD.login()) {
			dismissCodeVerifyDialog();
			// 会话超时，需要清除本地会话缓存
			YJKD.logout();
			showFragment(TAB_INDEX_LENDING, Constants.PAGE_LOADING);
			LoginActivity.start(this);
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
	public void onLoginResult(IEvent.LoginSuccessEvent event) {
		switch (event.id) {
			case IEvent.CODE_LOGIN_SUCCESS: {
				EventAgent.removeStickyEvent(event);
				CLog.i(TAG, "MainActivity removeStickyEvent");
				//mTabBottom.changeTab(PAGE_NEED_APPLY);
				showFragment(TAB_INDEX_LENDING, Constants.PAGE_LOADING);
				//EventAgent.post(new VerifyCodePresenter.Event(VerifyCodePresenter.Event.CODE_LOGIN_SUCCESS));
				break;
			}
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onLoanStatusResult(QuotaEvent.RefreshStatusEvent event) {
		switch (event.id) {
			case QuotaEvent.Event.QUOTA_REFRESH:
				showLoadingPage(false);
				if (YJKD.login())
					mMyQuotaPresenter.myQuota();
				break;
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onLoanNoticeClick(QuotaEvent.ShowLoanNoticeEvent event) {
		if (QuotaEvent.Event.QUOTA_SHOW_LOAN_NOTICE == event.id && Constants.PAGE_NO_MAIN_ACTIVITY == event.page) {
			showLoanNoticeDialog();
			onEvent(StatIDSet.EVENT_ID_CHECK_BORROWING_REQUIREMENTS);
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onClickPhoneCall(QuotaEvent.ShowCallDialogEvent event) {
		if (QuotaEvent.Event.QUOTA_SHOW_CALL_DIALOG == event.id && Constants.PAGE_NO_MAIN_ACTIVITY == event.page) {
			mPhoneNumber = event.phoneNumber;
			showCallDialog();
			if (mCurrentPage == Constants.PAGE_REPAYMENT){
				StatService.onEvent(this, StatIDSet.EVENT_ID_REIMBURSEMENT_CALL_SERVICE);
			}else {
				onEvent(StatIDSet.EVENT_ID_BORROW_MONEY_TO_CALL_CUSTOMER_SERVICE);
			}
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onShowIncreaseLoading(QuotaEvent.ShowIncreaseLoadingEvent event) {
		CheckPromoteStatusActivity.start(this);
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onComplexStatusTabChanged(QuotaEvent.ComplexStatusTabChangedEvent event) {
		mSavedTab = event.currentTab;
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onDismissCodeVerifyDialog(QuotaEvent.DismissCodeVerifyDialogEvent event) {
		dismissCodeVerifyDialog();
	}

	/**
	 * 获取数据埋点的事件属性ID,  属性：用户当前状态（未申请、初审中、初审通过等…）
	 */
	private void onEvent(String eventId){
		if(null == mApplyStatus){
			return;
		}
		HashMap<String,String> map = new HashMap<>();
		map.put(StatService.ATTRIBUTE_KEY_ONE,mApplyStatus.amountState);
		map.put(StatService.ATTRIBUTE_KEY_TWO,mApplyStatus.loanState);
		map.put(StatService.ATTRIBUTE_KEY_THREE,mApplyStatus.promoteAmount);
		StatService.onEvent(this, eventId, map);
	}

	private void showLoanNoticeDialog() {
		if (null == mLoanNoticeDialog)
			mLoanNoticeDialog = new CommonDialog(this, getString(R.string.lending_notice), true, R.layout.dialog_lending_notice);
		mLoanNoticeDialog.show();
	}

	private void dismissLoanNoticeDialog() {
		if (mLoanNoticeDialog != null && mLoanNoticeDialog.isShowing()) {
			mLoanNoticeDialog.dismiss();
			mLoanNoticeDialog = null;
		}
	}

	private void showCallDialog() {
		dismissCallDialog();
		mCallDialog = new CommonDialog(this, null, mPhoneNumber, getString(R.string.call), getString(R.string.cancel), this, true);
		mCallDialog.show();
	}

	private void dismissCallDialog() {
		if (mCallDialog != null && mCallDialog.isShowing()) {
			mCallDialog.dismiss();
		}
	}

	@Override
	public void showLoanPage(int page, MyQuotaModel.ApplyStatus status) {
		mOriginalApplyStatus = mApplyStatus;
		mApplyStatus = status;
		if (mCurrentPage == Constants.PAGE_REPAYMENT || mCurrentPage == Constants.PAGE_PERSONAL_CENTER) {
			mIsFirst = false;
			mPreviousLendingPage = page;
		} else {
			//判断是否有在途借款
			if(mIsFirst){
				if(Constants.PAGE_LOADING != page){
					mIsFirst = false;
				}
				if(null != status && Constants.QUOTA_STATUS_HAVE_LOAN.equals(status.amountState)){
					mCurrentTab = TAB_INDEX_REPAYMENT;
					showFragment(mCurrentTab, Constants.PAGE_REPAYMENT);
				}else{
					mCurrentTab = TAB_INDEX_LENDING;
					showFragment(mCurrentTab, page);
				}
			}else{
				mCurrentTab = TAB_INDEX_LENDING;
				showFragment(mCurrentTab, page);
			}
		}
	}

	public void showLoadingPage(boolean noNetWork) {
		mGetQuotaFail = noNetWork;
		showLoanPage(Constants.PAGE_LOADING, null);
	}

	@Override
	public void getStatusFail(String msg) {
		showLoadingPage(true);
	}

	@Override
	public void creditReportingOutdated() {
		showOneBtnDialog("", getString(R.string.credit_report_outdated_notice), getString(R.string.got_it), new CommonDialog.ButtonClickListener() {
			@Override
			public void onCancel(CommonDialog dialog) {
				dialog.dismiss();
			}

			@Override
			public void onConfirm(CommonDialog dialog) {
				dialog.dismiss();
				initPage();
			}
		}, false);
	}

	@Override
	public void onFunctionalError(Throwable e, boolean autoTips, int functionalCode) {
		super.onFunctionalError(e, autoTips, functionalCode);
		switch (functionalCode) {
			case MyQuotaModel.METHOD_MY_QUOTA:
				runOnUiThread(new Runnable() {
					@Override
					public void run() {
						showLoadingPage(true);
					}
				});
				break;
		}
	}

	@Override
	public void getMsgStatusSuccess(int msgCount) {
		Global.sHasNewMsg = true;
		EventAgent.post(new QuotaEvent.ShowRedDotEvent());
	}

	@Override
	public void onCancel(CommonDialog dialog) {
		dismissCallDialog();
	}

	public InviteCodeVerifyDialog createInviteCodeDialog(){
		if (mCodeVerifyDialog == null) {
			mCodeVerifyDialog = new InviteCodeVerifyDialog(this);
		}
		return mCodeVerifyDialog;
	}

	@Override
	public void onConfirm(CommonDialog dialog) {
		dismissCallDialog();
		if(mCurrentPage != Constants.PAGE_REPAYMENT){
			onEvent(StatIDSet.EVENT_ID_CONFIRM_CALL_CUSTOMER_SERVICE);
		}
		//忽略手势密码
		Global.setThirdPartyPageOpenedFlag(true);
		YJKD.tel(this, mPhoneNumber.replaceAll("-", ""));
	}

	@Override
	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onTimerEvent(TimerEvent timerEvent) {
		if (mMyQuotaPresenter != null) {
			if (YJKD.login())
				mMyQuotaPresenter.myQuota();
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onMessageEvent(QuotaEvent.PageJumpEvent event) {
		switch (event.id) {
			case QuotaEvent.Event.QUOTA_JUMP_HELP_PAGE:
				if (Constants.PAGE_NO_MAIN_ACTIVITY == event.page && !TextUtils.isEmpty(Global.HELP_URL)) {
					WebViewActivity.start(this, Global.BASE_URL + Global.HELP_URL, getString(R.string.help_center), getString(R.string.title_activity_feedback));
				}
				break;
			case QuotaEvent.Event.QUOTA_JUMP_MESSAGE_PAGE:
				if (!YJKD.login()) {
					LoginActivity.start(this, true);
					break;
				}
				if (Constants.PAGE_NO_MAIN_ACTIVITY == event.page) {
					MessageActivity.start(this);
				}
				break;
		}
	}

	@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
	public void onShowVideoVerifyHintEvent(QuotaEvent.ShowVideoVerifyHintEvent event) {
		EventAgent.removeStickyEvent(event);
		mVideoVerifyHintAuto = true;
	}

	@Subscribe(threadMode = ThreadMode.MAIN)
	public void onHaveNewPushEvent(QuotaEvent.HaveNewPushEvent event) {
		//有新push且已解锁，自动跳到消息页面
		if (Global.NEW_PUSH && !Global.LOCKED) {
			Global.NEW_PUSH = false;
			mHasNewPush = false;
			MessageActivity.start(this);
		}
	}
}